package com.lagou.tool;

import lombok.Data;

@Data
public class CommonResponse<T> {

    private  T t;

    private Object object;

    private Integer code;

    private String msg;

    private int ret=0;

    private CommonResponse commonResponse;

    public CommonResponse(){
    }

    public CommonResponse(int code,String msg){
        this.code=code;
        this.msg=msg;
    }
    public CommonResponse(int code,String msg,Object data){
        this.code=code;
        this.msg=msg;
        this.object=data;
    }


    public CommonResponse(int code,int ret,String msg){
        this.code=code;
        this.ret=ret;
        this.msg=msg;
    }

    public static CommonResponse success(){
        return new CommonResponse(200,"success");
    }

    public static CommonResponse successWithData(Object t){
        return new CommonResponse(200,"success",t);
    }

    public static CommonResponse Fail(){
        return new CommonResponse(500,"success");
    }
    public static CommonResponse FailWithMsg(int ret,String msg){
        return new CommonResponse(400, ret,msg);
    }
}
